// Copyright 2011 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.


/**
 * @fileoverview Unit tests for bite.layer.soy.User.
 *
 * @author jasonstredwick@google.com (Jason Stredwick)
 */


goog.require('bite.common.test_framework.SoyTests');
goog.require('bite.layer.soy.User');
goog.require('goog.testing.MockControl');
goog.require('goog.testing.PropertyReplacer');


var stubs_ = new goog.testing.PropertyReplacer();
var mockControl_ = null;


function setUp() {
  mockControl_ = new goog.testing.MockControl();
}


function tearDown() {
  if (mockControl_) {
    mockControl_.$tearDown();
    mockControl_ = null;
  }
  stubs_.reset();
}


/**
 * Test bite.layer.soy.User.getView.
 */
function testGetView() {
  var soyTests = bite.common.test_framework.SoyTests.getInstance();
  var template = bite.layer.soy.User.getView;
  var tag = 'href';

  var expectedValue = 'layer/resources/user.css';
  var url = '';
  soyTests.testAttributeValue(assertEquals, expectedValue, tag, template,
      {baseUrl: url});

  soyTests.testAttributeValue(assertEquals, expectedValue, tag, template, {});

  url = 'http://www.google.com/';
  expectedValue =
      'http://www.google.com/layer/resources/user.css';
  soyTests.testAttributeValue(assertEquals, expectedValue, tag, template,
      {baseUrl: url});
}

